import React, { useState } from 'react'
import { Link, Outlet } from 'react-router-dom'
export default function News() {
  const [message] = useState([
    { id: '001', title: '消息1', content: '1111111' },
    { id: '002', title: '消息2', content: '2222222' },
    { id: '003', title: '消息3', content: '3333333' },
    { id: '004', title: '消息4', content: '4444444' },
  ])
  return (
    <div>
      <ul>
        {
          message.map((item) => {
            return (
              <li key={item.id}>
                <Link to='details' state={{ id: item.id, title: item.title, content: item.content }} >{item.title}</Link>
              </li>
            )
          })
        }
      </ul>
      <Outlet></Outlet>
    </div >
  )
}
